<?php

namespace App\Trip\Passengers;

use JetBrains\PhpStorm\ArrayShape;

class IdentityCodeNameCheckRes
{
    private array $result;

    #[ArrayShape([
        "check_state" => "int",
        "info"        => "array",
    ])]
    public function __construct(array $result)
    {
        $this->result = $result;
    }

    public function getErrorMsg()
    {
        return $this->result['error_msg'] ?? 'success';
    }

    public function isPassCheck(): bool
    {
        return $this->getCheckState() == 1;
    }

    /**
     * 0 失败 1 成功
     *
     * @return int
     */
    public function getCheckState(): int
    {
        return $this->result['check_state'] ?? 0;
    }

    public function getInfo(): array
    {
        return $this->result['info'] ?? [];
    }
}